import request from '@ey-utils/utils/services/request';
import api from '../api';

/**
 *  King
 */
export const create = async (values: any) => {
  return await request(api.modelCreate, {
    method: 'post',
    data: values
  }).then(res => {
    return res;
  });
};
export const createNew = async (values: any) => {
  return await request(api.modelCreateNew, {
    method: 'post',
    data: values
  }).then(res => {
    return res;
  });
};
export const update = async (values: any) => {
  return await request(api.modelUpdate, {
    method: 'post',
    data: values
  }).then(res => {
    return res;
  });
};
export const detail = async (id: string) => {
  return await request(api.modelDetail, {
    method: 'get',
    params: {
      id,
      time: new Date().toISOString()
    }
  }).then(res => {
    return res;
  });
};
export const page = async (queryKeys: any, pageNo: number, pageSize: number) => {
  return await request(api.modelPage, {
    method: 'post',
    data: {
      mdType: 'MetaMeta',
      pageNo,
      pageSize,
      queryKeys,
    }
  }).then(res => {
    return res;
  });
};
export const remove = async (id: string) => {
  return await request(api.modelRemove, {
    method: 'get',
    params: { id, }
  }).then(res => {
    return res;
  });
};
export const list = async () => {
  return await request(api.modelList, {
    method: 'get',
  }).then(res => {
    return res;
  });
};
export const generate = async (id: string) => {
  return await request(api.modelGen, {
    method: 'get',
    params: { id, }
  }).then(res => {
    return res;
  });
};
